<%@page import="com.xnx3.j2ee.Global"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.xnx3.com/java_xnx3/xnx3_tld" prefix="x"%>
<jsp:include page="/wm/common/head.jsp">
	<jsp:param name="title" value="列表" />
</jsp:include>

<jsp:include page="/wm/common/list/formSearch_formStart.jsp"></jsp:include>
<jsp:include page="/wm/common/list/formSearch_input.jsp">
	<jsp:param name="iw_label" value="代理商名称" />
	<jsp:param name="iw_name" value="name" />
</jsp:include>

<input class="layui-btn iw_list_search_submit" type="submit" value="搜索" />
<a href="javascript:editItem(0,'');" class="layui-btn">添加代理商</a>
	<a href="javascript:checkAll('');" class="layui-btn" >地图展示</a>
</form>
<div class="tabox" style="padding:0 20px;min-width: 1200px;">
<table class="layui-table iw_table" style="min-width: 1200px;">
	<thead>
		<tr>
			<th style="width:160px; text-align:center">代理商名称</th>
			<th style="width:160px; text-align:center">负责区域</th>
			<th style="width:50px; text-align:center">负责人</th>
			<th style="width:100px; text-align:center">手机号</th>
			<th style="width:100px; text-align:center">注册时间</th>
			<th style="width:180px; text-align:center">操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${list}" var="item">
			<tr>
				<td style="width:160px;">${item.name}</td>
				<td style="width:160px;"><x:substring maxLength="25" text="${item.addminArea }"></x:substring>
				</td>
				<td style="width:50px;"><x:substring maxLength="25" text="${item.contactName }"></x:substring>
				</td>
				<td style="width:100px;"> <x:substring maxLength="25" text="${item.phone }"></x:substring>
				</td>
				<td style="width:100px;"><x:time linuxTime="${item.addtime }"
						format="yyyy-MM-dd HH:mm"></x:time></td>
				<td style="width: 180px; "><botton
						class="layui-btn layui-btn-sm"
						onclick="check('${item.sheng }', '${item.shi }','${item.qu }','${item.userid }', '${item.name }');"
						style="margin: 1px 1px;">查看电子围栏</botton> <botton
						class="layui-btn layui-btn-sm"
						onclick="editItem(${item.id}, '${item.name }');"
						style="margin: 1px 1px;">修改</botton> <botton
						class="layui-btn layui-btn-sm"
						onclick="deleteItem(${item.id}, '${item.name }');"
						style="margin: 1px 1px;">删除</botton></td>
			</tr>
		</c:forEach>
	</tbody>
</table>
</div>
<!-- 通用分页跳转 -->
<jsp:include page="/wm/common/page.jsp"></jsp:include>

<script type="text/javascript">
//根据id删除
function deleteItem(id,name){
	var dtp_confirm = layer.confirm('确定要删除代理商“'+name+'”？删除后不可恢复！', {
	  btn: ['删除','取消'] //按钮
	}, function(){
		layer.close(dtp_confirm);
		
		parent.msg.loading("删除中");    //显示“操作中”的等待提示
		$.post('deletev2.json?id='+id, function(data){
		    parent.msg.close();    //关闭“操作中”的等待提示
		    if(data.result == '1'){
		        parent.msg.success('操作成功');
		        window.location.reload();	//刷新当前页
		     }else if(data.result == '0'){
		         parent.msg.failure(data.info);
		     }else{
		         parent.msg.failure();
		     }
		});
		}, function(){
	});
}
//查看电子围栏
function check(sheng ,shi ,qu ,userid ,name ){
	layer.open({
		type:2,
		title:'查看代理商&nbsp;[&nbsp;' + name + '&nbsp;]&nbsp;电子围栏',
		area: ['100%', '100%'],
		shadeClose: true, //开启遮罩关闭
	    content: 'check.do?sheng=' + sheng + '&shi=' + shi + '&qu=' + qu + '&userid=' + userid
	});
}
//地图展示 1051px
function checkAll() {
	layer.open({
		type:2,
		title:'地图展示',
		area: ['100%', '100%'],
		shadeClose: true, //开启遮罩关闭
	    content: 'checkAll.do'
	});
}
//修改
function editItem(id, name){
	layer.open({
		type: 2, 
		title:id > 0? '修改代理商&nbsp;[&nbsp;' + name + '&nbsp;]&nbsp;':'添加代理商', 
		area: ['60%', '80%'],
		shadeClose: true, //开启遮罩关闭
		content: 'editv2.do?id='+id
	});
}
</script>

<jsp:include page="/wm/common/foot.jsp"></jsp:include>